﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
//using SilverMessengerLib;
using SilverlightParser.Web.Backend;
namespace SilverlightParser.Web
{
    /// <summary>
    /// MentorService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class MentorService : System.Web.Services.WebService
    {
        public enum JobQueueType
        {
            NewJob,
            Result
        }
        [WebMethod]
        public Job GetJob(string clientid, JobQueueType type)
        {
            if (clientid == null)
                return new Job();
            if(type == JobQueueType.NewJob)
                return Reference.GetMarket(Application).GetJob(clientid);
            else
                return Reference.GetMarket(Application).GetJobResult(clientid);
        }


        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public void PostJob(Job job)
        {
            Reference.GetMarket(Application).PostJob(job);
        }

        [WebMethod]
        public void PostLearnLangNodesJob(LearnLangNodesJob job)
        {
            Reference.GetMarket(Application).PostJob(job);
        }
        //[WebMethod]
        //Job GetJob(string clientid)
        //{
        //    if (clientid == null)
        //        return new Job();
        //    return Reference.GetMarket(Application).GetJob(clientid);
        //}
        [WebMethod]
        public void PostJobResult(Job job)
        {
            Reference.GetMarket(Application).PostJobResult(job);
        }
        [WebMethod]
        TestClass GetJobResult2(string clientid)
        {
            return null;
        }

    }
}
